#include "MainMenuView.h"
#include <iostream>
#include "Utils.h"
#include "SettingController.h"
#include "UserController.h"
#include "SessionController.h"
#include <Windows.h>

void MainMenuView::showMainMenu()
{
    setBackGround();
    while (true)
    {
        Utils::clearBackGround();
        if (!UserController::getInstance()->hasUser())
        {
            UserController::getInstance()->createUser();
        }
        Utils::setCursorPsn(35, 11, "1 : create user");
        Utils::setCursorPsn(35, 13, "2 : set config");
        Utils::setCursorPsn(35, 15, "3 : ready to game");
        Utils::setCursorPsn(35, 17, ":");
        short menu = 0;
        std::cin >> menu;
        switch (menu)
        {
        case 1:
        {
            UserController::getInstance()->createUser();
            break;
        }
        case 2:
        {
            SettingController::getInstance()->saveSetting();
            SettingController::getInstance()->showSetting();
            break;
        }
        case 3:
        {
            SessionController::getInstance()->ready2Game();
            break;
        }
        default:
            break;
        }
    }
}

void MainMenuView::setBackGround()
{
    Utils::initBackGround();
}

